package com.miku.blog.controller;

import com.miku.blog.annotation.SystemLog;
import com.miku.blog.domain.pojo.ResponseResult;
import com.miku.blog.service.UploadFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author shkstart
 * @create ${}YEAR-06-16 4:27
 */
@Api(tags = "上传用户头像")
@RestController
public class UserAvatarUploadController {

    @Autowired
    private UploadFileService uploadFileService;


    @SystemLog(notes = "上传个人头像{后台管理系统}")
    @ApiOperation(value = "上传个人头像接口")
    @PostMapping("/users/avatar")
    public ResponseResult uploadUserAvatarImages(@RequestParam("file") MultipartFile multipartFile){
        return uploadFileService.uploadUserAvatarImages(multipartFile);
    }

    @SystemLog(notes = "取消上传个人头像{后台管理系统}")
    @ApiOperation(value = "取消上传个人头像接口")
    @DeleteMapping("/users/delImages")
    public ResponseResult deleteUserAvatarImages(@RequestParam("userAvatar") String userAvatar){
        return uploadFileService.deleteUserAvatarImages(userAvatar);
    }


}
